<script setup lang="ts">
import { computed } from "vue";
import { useRoute } from "vue-router";
import MainLayout from "@/layout/MainLayout.vue";
import Login from "@/views/Login.vue";

const route = useRoute();

// 不需要使用 layout 的页面路径（支持 base path）
const basePath = import.meta.env.MODE === "production" ? "/yfqy-web" : "";
const standalonePages = ["/login"];
const isStandalonePage = computed(() => {
  const path = route.path.replace(basePath, "") || "/";
  return standalonePages.includes(path);
});
</script>

<template>
  <Login v-if="route.path === '/login' || route.name === 'Login'" />
  <MainLayout v-else-if="!isStandalonePage" />
  <router-view v-else />
</template>
